<?php

class HomeController extends BaseController {

	/*
	|--------------------------------------------------------------------------
	| Default Home Controller
	|--------------------------------------------------------------------------
	|
	| You may wish to use controllers instead of, or in addition to, Closure
	| based routes. That's great! Here is an example controller method to
	| get you started. To route to this controller, just add the route:
	|
	|	Route::get('/', 'HomeController@showWelcome');
	|
	*/
	protected $layout = 'layouts.master';

	public function index()
	{
		$page_num = isset($_GET['page'])?$_GET['page']:1;
		$data = array();
		$video_json = file_get_contents('http://api.demo/api/videos?page='.$page_num);
        $json = json_decode($video_json,true);
        $profile_json = file_get_contents('http://api.demo/api/profile');
        $json2 = json_decode($profile_json,true);
        $data = $json['state'];
        $profile = $json2['profile_info'];
        $profile_count = $json2['count'];
        //return $data;
		return View::make('demo.index' , array('datas' => $data['data'], 'page' => $data,'profile'=>$profile,'profile_count'=>$profile_count));
	}

	public function showProfile()
	{

	}

	public function showWelcome()
	{
		return View::make('hello');
	}

}